package ACM.meituan2;

/**
 * @Author wwk
 * @DATE 2022/8/27 16:15
 */
import java.util.*;
public class second {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();  //链子上的宝石数
        int m = scanner.nextInt();  //操作次数
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < m; i++) {
            int num = scanner.nextInt();
            Integer num1 = Integer.valueOf(num);
            //如果重复，则只保留最后一次的
            if(list.contains(num1)){

                list.remove(num1);

            }
            list.add(num1) ;
        }
        List<Integer> res = new ArrayList<>();
        Collections.reverse(list);
        res.addAll(list);
        for(int i=1;i<=n;i++){
            if(!list.contains(i)){
                res.add(i);
            }
        }

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < res.size(); i++) {
            sb.append(res.get(i)+" ");
        }
        System.out.println(sb.toString().trim());
    }
}
